recurrent state
Joint KV-Cache and Recurrent-State Quantization in Hybrid Linear-Attention LLMs
Hybrid language models that interleave linear-attention layers with softmax attention keep two inference memories: a KV cache that grows with the context and a fixed-size recurrent state. Post-training quantization has studied each in isolation, but a serving engine must split one budget between them. We present the first joint study of post-training, calibration-free quantization of both memories in Gated DeltaNet hybrids (Qwen3.5, 0.8B to 9B), with a Mamba-2 hybrid (Falcon-H1) as control. The asymmetry is large: 4-bit KV costs at most 0.03 nats, whereas a 4-bit state costs about one nat; in the Mamba-2 hybrid the same 4-bit state costs nothing, pointing to the delta rule. The two errors are only weakly super-additive, so the memories can be allocated almost independently. A noise-matched control shows that round-to-nearest is idempotent, which keeps state error far below a worst-case bound, while per-layer sensitivity is concentrated in the first layer rather than following the decay half-life. The limiting memory is task dependent: retrieval is bounded by the KV cache and reasoning by the state, where an 8-bit state lowers GSM8K accuracy from 0.600 to 0.345 unless error feedback is used. On Qwen3.5-4B, 4-bit KV with a 6-bit state and error feedback uses 32% of the bf16 cache for 0.04 nats and GSM8K 0.555, and 4-bit KV with an 8-bit state and error feedback is lossless at 40%.
SPARE: State-Aware Recurrent Memory Compression for Efficient Hybrid Language Models
Wan, Ke, Zheng, Zaiyi, Chen, Chen
Modern hybrid language models increasingly incorporate recurrent architectures, including gated linear attention and selective state-space models, to improve inference efficiency. While these architectures summarize historical information in fixed-size states, recurrent memory often exhibits substantial low-rank redundancy, offering opportunities for further compression. To exploit this redundancy, we introduce SPARE (State Projection for Accelerated Recurrent Execution), a training-free framework that compresses recurrent memory into fixed low-dimensional subspaces. SPARE constructs these subspaces through principal component analysis of recurrent-state statistics and supports rank allocation across layers and heads. Crucially, SPARE maintains and updates recurrent states directly in the compact space, enabling efficient recurrent reads and writes without online decomposition or dense-state reconstruction. This design reduces both recurrent-state memory traffic and per-request storage, improving decoding efficiency and supporting higher inference concurrency. Across two hybrid language models, OLMo Hybrid 7B and Granite 4.0 H-Small, SPARE achieves 4-fold recurrent-state compression and up to 2.00x peak full-model decoding throughput, while preserving or improving six-task average retrieval accuracy with its quality-oriented configuration.
PrefixChain: Compact Prefix Caching for Hybrid LLMs
Wang, Genglin, Yin, Wangsong, Zeng, Liekang, Abudunuer, Yeerzhati, Xu, Haoxuan, Yan, Zhenyu, Xing, Guoliang
Hybrid LLMs combine linear attention with full attention to bound memory growth during long-context inference. Each linear-attention layer summarizes token history in a fixed-size recurrent state instead of a growing KV cache. However, this design creates a severe capacity bottleneck for prefix caching. Because recurrent states are overwritten in place, rolling back to prefixes requires saving bulky state checkpoints repeatedly. We introduce PrefixChain, a compact prefix caching system for hybrid LLMs. Our key insight is that recurrent states evolve across tokens with strong inter-state redundancy, as each linear-attention step decays the prior state before applying an incremental update. Inspired by inter-frame video coding, PrefixChain organizes checkpoints into closed-loop chains of anchor I-states and low-rank residual P-states, allocating per-head ranks via offline readout-error profiling. To serve chains efficiently online, PrefixChain pipelines layer-grouped encoding asynchronously off the forward path, reconstructs multi-step chains in a single fused GPU kernel, and coordinates dependency-aware eviction with the KV cache. Across three hybrid LLMs and four workloads, PrefixChain shrinks checkpoints by $31.3\times$ to $55.7\times$ with negligible quality loss and reduces mean TTFT by up to $5.03\times$ over state-of-the-art serving systems, such as SGLang, vLLM, and Marconi, while incurring low online encoding overhead.
RAM-Net: Linear-Time Sequence Modeling with Sparsely Addressable State
Xiao, Kaicheng, Li, Haotian, Dong, Liran, Xing, Guoliang
Linear attention offers an efficient alternative to full attention with a fixed-size recurrent state. However, this state is shared by all tokens, so information from distinct tokens becomes superposed within it and produces inter-token interference that degrades long-range fine-grained recall. To address this issue, we propose RAM-Net, which replaces dense access to a shared state with sparse address-based access. RAM-Net organizes the recurrent state as a fixed-size array of independent slots and uses an Address Decoder that maps each key or query into a sparse address, selecting a small subset of slots to write to or read from at each step. This design directs tokens with non-overlapping addresses to disjoint slots, suppressing inter-token interference, while keeping per-step state access dependent only on the number of selected slots rather than the total state size. Empirically, RAM-Net outperforms strong recurrent baselines on fine-grained long-range retrieval and achieves the lowest perplexity with competitive commonsense reasoning. It does so while accessing fewer state elements per step than all baselines, e.g., $8\times$ fewer than Mamba2.
STEPQuant: When and Where Errors Matter in Delta-Rule Recurrent State Quantization
Yao, Bingchen, Xu, Haobo, Lin, Haokun, Wu, Yichen, Guo, Ziyu, Zhang, Renrui, Lu, Zhichao, Sun, Zhenan, Wei, Ying
Linear attention replaces growing KV caches with fixed-size recurrent states, yet these persistent states can become a substantial memory bottleneck under concurrent serving. Directly quantizing recurrent states to low precision often leads to severe accuracy degradation, as quantization errors propagate through successive state updates. We discover that the impact of these errors depends on two complementary dimensions: temporally, errors in long-lived memory can persist across many decoding steps; spatially, errors in different key rows affect model outputs differently, while state magnitudes vary substantially along both rows and columns. Motivated by these observations, we propose STEPQuant, a spatial-temporal post-training quantization framework for Delta-rule recurrent states. STEPQuant allocates precision according to error magnitude and memory lifetime, and jointly fits key-row and value-column scales based on state distributions and key-row impact on output error. Experiments on Qwen3.8-27B and Kimi-Linear-48B-A3B-Instruct across both long- and short-generation benchmarks show that STEPQuant closely matches FP32-state accuracy under a nominal 6-bit budget and outperforms uniform INT8 in its 4-bit configuration. Integrated into SGLang with optimized GPU kernels, 6-bit STEPQuant achieves over 5x recurrent-state compression and reduces total serving memory by up to 68.7%. Our code is available at https://github.com/Dreamer-Toby/STEPQuant.
When Dynamic Scaling Fails: A Scale-State Feedback Governs Recurrent-State Quantization in Linear-Attention and SSM LLMs
Linear-attention and state-space LLMs carry long context in a fixed-size recurrent state, and quantizing that state is the natural way to cut its cost during long decode. Unlike a weight tensor, the state is rewritten at every step, so a quantizer applied at each step sits inside the recurrence and its errors compound. INT4 that leaves synthetic recall perfectly intact at the start destroys it a thousand steps later. The mechanism is a feedback between the quantizer scale and the state it is derived from. Yoking that scale to a full-precision reference removes the resulting norm explosion entirely, yet recovers only 1.8 of the 5.4 nats lost, so numerical instability and functional degradation are separable failures. The remainder is resolution-dependent, and in our per-step setting every outlier-aware scheme we test loses to plain persistent scaling. Allocating bits across layers does help, but under article-disjoint splits a learned allocation collapses onto the trivial rule of protecting the first few layers. Run out to 32K, group-wise INT4 is worth no more than discarding the state. Contain the scale rather than locate outliers, and report the decode horizon at which a bit-width was certified.
ReaDy: Recurrent States as Dynamic Context for Speculative Drafting in Hybrid Linear Attention Large Language Models
Sun, Bohan, Su, Zunhai, Zhuang, Xialie, Li, Jianjin, Wong, Ngai, Kuo, Chuan-Wei
Speculative decoding accelerates autoregressive generation by drafting multiple tokens per step, yet feature-based drafters rely on target hidden features whose contextual emphasis may not align with the needs of subsequent draft positions. Hybrid linear attention (HLA) models maintain compact recurrent states that accumulate historical associations, offering an efficient source of complementary context for speculative drafting. We introduce ReaDy, the first speculative decoding method, to the best of our knowledge, to leverage HLA recurrent states for position-specific context retrieval during drafting. ReaDy equips each draft position with a learned query to retrieve supplementary context directly from the target's committed recurrent states. A lightweight state reader integrates this context into draft representations through residual updates, while low-rank state reads and fused operators keep additional computation and I/O overhead low. Building on DSpark's parallel backbone and sequential prediction head, ReaDy employs a lightweight two-stage adaptation strategy, with reader capacity, state sources, and residual placement examined through ablation studies. Across seven benchmarks spanning mathematics, code generation, and dialogue, ReaDy achieves an average $3.16\times$ decoding speedup over autoregressive decoding with Qwen3.8-27B on a single NVIDIA B200 GPU. It outperforms DSpark on every benchmark, improving throughput by 7.97% and acceptance length by 8.50% on average. Our code is available at https://github.com/StartLuxLabs/ReaDy.
Tandem: Serving Hybrid Linear-Attention GUI Agents on Mobile NPUs
Chen, Zhuomin, Ni, Jingchao, Zheng, Xu, Chen, Yong, Sha, Mo, Cheng, Wei, Luo, Dongsheng
Smartphone GUI agents complete tasks in mobile apps by repeatedly reading the screen and asking a model for the next action. Mobile neural processing units (NPUs) enable local execution, keeping screen contents on the phone, but model latency accumulates with every action. Hybrid linear attention models reduce memory requirements, yet reusing their recurrent state requires checkpoints at the appropriate input positions. Agent requests retain instructions but rewrite recent history, so checkpoint policies designed for chat continuation can miss reusable prefixes. Retaining rollback states for speculative decoding can also move prompt processing off the NPU's matrix unit, adding overhead that outweighs decoding savings on short action outputs. A loaded model can further hold the NPU awake between tasks. We present Tandem, a runtime for hybrid GUI agents on mobile NPUs. Tandem saves recurrent state where consecutive prompts diverge, allowing later requests to reuse previously processed context. It keeps most prefill on the matrix unit and produces rollback states through a short per-token tail. Its verification kernel reads each weight block once for all proposed tokens. Between request bursts, Tandem releases NPU power votes without unloading the model. We implement Tandem in llama.cpp and evaluate it on recorded agent interactions across two Snapdragon generations. On a Snapdragon 8 Elite, Tandem reduces per-step latency by 30% for text-based screen descriptions and 16% for screenshots relative to llama.cpp's fastest NPU configuration, reduces energy per text step by 33%, and lowers standby power with the model loaded from 0.76 to 0.22 W.
Tail-Replay: Escaping the Curse of Linear Attention in Prefix Caching for Hybrid LLMs
Liu, Yirui, Qi, Ruoling, Wu, Xuaner, Liu, Penghang, Chen, Jian
Hybrid large language models interleave full-attention layers with linear-attention layers to reduce the cost of long-context inference. This structure complicates prefix caching: full-attention key-value caches are token-addressable, whereas linear-attention layers maintain recurrent states that cannot be rolled back to arbitrary prefix boundaries. Existing hybrid prefix caching methods address this mismatch by storing recurrent-state checkpoints. As a result, token-level matches are directly usable only at positions aligned with stored checkpoints, constraining prefix reuse to a discrete set of boundaries. We present Tail-Replay, a prefix caching mechanism that enables unconstrained token-level prefix reuse in hybrid large language models. The key insight is that linear-attention mechanisms such as Gated DeltaNet can be viewed as a structured, lossy compression of the input prefix: gated recurrent updates progressively attenuate the contributions of earlier inputs. Consequently, the recurrent state of a matched prefix can be well approximated by replaying only a short, recent suffix of that prefix. Tail-Replay exploits this property by caching the exact full-attention key-value cache while omitting recurrent-state checkpoints. On a cache hit, it reconstructs the linear-attention states by replaying a short, recent suffix of the matched prefix. As a result, the reuse boundary is determined by the shared tokens rather than by recurrent-state checkpoints. We evaluate Tail-Replay on three Gated DeltaNet-based hybrid models using the LongBench and RULER benchmarks. With only a 5--10\% replay budget, it retains 92.8--99.9\% of full-prefill quality on LongBench and RULER. For serving efficiency, we evaluate time-to-first-token speedups across multiple matched-prefix lengths---8K, 16K, and 32K. The speedup grows with prefix length, reaching $9.1$--$14.3\times$ over full prefill at 32K.
Residual Streams Read, Recurrent States Remember: The Global Workspace in Mamba Models
Can the global-workspace account of transformer representations extend to state-space language models? We fit Jacobian lenses to the residual streams and recurrent states of Mamba-1, Mamba-2 and Mamba-3, using the original 1000-prompt recipe. Joint residual--state readouts improve recovery of known intermediate concepts over the residual lens on at least five of six task families in every tested Mamba checkpoint. On Mamba-2, state alone exceeds residual and logit lenses on all six families; a normalised joint readout improves on both components on five. Temporal maps and word-list experiments show earlier content remaining state-readable as residual visibility changes. We also propose sign-guarded steering, which improves target top-five success over coordinate exchange on matched verbal-report trials in five models. Recurrent state alone supports this verbal access. These gains do not extend consistently to relational answers: guarded edits often output the edited concept itself, and Mamba-3's joint edits can disrupt successful state-only redirection. Recurrent state thus provides a complementary carrier of workspace content, whose recovery, persistence and causal uses require separate measurements.